<template>
	<view class="about_us_box">
		<view class="about_create_time">
			发布时间：2023-1-30
		</view>
		<rich-text v-if="nodes" :nodes="nodes"></rich-text>
		<view class="erweima_box">
			<Avatar v-if="systemId==='1'" :isAllowPreview="true" radius="0rpx" size="600rpx" :fileName="imgPath" :joinUrlFun="joinSystemPath"/>
		</view>
	</view>
</template>

<script setup>
	import {onLoad} from '@dcloudio/uni-app'
	import {ref} from 'vue'
	import {
		dynamicStyleStore
	} from '@/stores/dynamicStyle.js'
	import parseHtml from '@/utils/strChangeNode.js'
	import {UserModel} from '@/service/model/user.js'
	
	import Avatar from '@/components/Avatar/Avatar.vue'
	
	import {
		joinSystemPath
	} from '@/utils/imgJoinName.js'
	
	const userModel = new UserModel()
	
	const dynamicStyle_store = dynamicStyleStore()
	
	const {
		primary_text_color,
		primary_hot_color,
		shallow_text_color
	} = dynamicStyle_store.globalStyle
	
	const nodes=ref()
	const systemId = ref('')
	const imgPath = ref('')
	const getSystemDocFun=async(id)=>{
		systemId.value = id
		const {data,success}=await userModel.getSystemDoc({},id)
		if(success){
			nodes.value = parseHtml(data?.content)
			imgPath.value = data?.erweima
		}
	}
	
	onLoad((opt)=>{
		const {systemId}=opt
		
		switch(systemId){
			case '1':
				uni.setNavigationBarTitle({
					title:"关于平台"
				})
				break
			case '2':
				uni.setNavigationBarTitle({
					title:"更新日志"
				})
				break
		}
		
		if(systemId) getSystemDocFun(systemId)
	})
</script>

<style lang="less">
	.about_us_box{
		padding: 10rpx 20rpx;
		color: v-bind(primary_text_color);
		.about_create_time{
			width: 100%;
			text-align: end;
			font-size: 25rpx;
			color: v-bind(shallow_text_color);
		}
		.erweima_box{
			width: 100%;
			display: flex;
			justify-content: center;
		}
		.title{
			color: v-bind(primary_hot_color);
			font-size: 35rpx;
			margin: 10rpx 0;
		}
		.content{
			font-size: 28rpx;
			text-indent: 2em;
		}
	}
</style>
